home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d8 / rbcomm33.arc / EXAMPLES.MAC < prev    next >
Text File  |  1991-04-28  |  3KB  |  90 lines

  1. ; RBcomm macro examples
  2. ;
  3. ;   by Ralf Brown
  4.  
  5. ;---------------------------------------------------------------
  6. ; beep every half hour
  7. ;   continues until another macro file loaded or some other binding
  8. ;   issues a CANCEL_DELAYED ALL
  9. ;
  10. F2    DELAYED 1800
  11.        CALL #199      ; 200-255 are reserved
  12.  
  13. #199    MULTI
  14.     BEEP
  15.     DELAYED 1800
  16.        CALL #199
  17.      END
  18.  
  19. ; I have been asked "why CALL instead of PUSHKEY?" and "why doesn't the second
  20. ; CALL cause some kind of infinite loop?"
  21. ;
  22. ; The difference between PUSHKEY and CALL is that PUSHKEY #199 will not cause
  23. ; the #199 macro to execute until the next time RBcomm reads the keyboard at
  24. ; the terminal emulation level (it would be discarded by the line-input
  25. ; function, for example).  The CALL executes immediately and then continues
  26. ; execution with the next line of the macro (if any).  As written, the 'beep
  27. ; every half hour' macro will cause a beep even if currently executing another
  28. ; macro; with PUSHKEY, the beep would not occur until the current macro
  29. ; completes--unless the macro is/will execute a command which takes input, in
  30. ; which case the #199 will be lost, ending the repetition.  You don't get an
  31. ; infinite nesting because the DELAYED command simply stores a pointer and the
  32. ; desired time, then exits.  Thus, the macro works something like this:
  33. ;
  34. ;     create an event for CALL #199
  35. ;     exit F2
  36. ;     ...
  37. ;     time to wake up and execute the CALL #199
  38. ;         BEEP
  39. ;         create an event for CALL #199
  40. ;         exit #199
  41. ;     exit CALL #199
  42. ;     ...
  43. ;     time to wake up again and execute the CALL #199
  44. ;         BEEP
  45. ;         create an event for CALL #199
  46. ;         exit #199
  47. ;     exit CALL #199
  48. ;     ...
  49. ;     time to wake up again and execute the CALL #199
  50. ;     etc.
  51. ;
  52. ; As you can see, at any given time, there is at most one pending event and one
  53. ; invocation of #199.
  54.  
  55. ;---------------------------------------------------------------
  56. ; display a time-limited message without DESQview message-box
  57. ;    note: should be on top-most row to avoid a mess if screen scrolls during
  58. ;       wait interval
  59. ;
  60. F3    MULTI
  61.     MESSAGE 0 50 "^ATimed test message"
  62.     DELAYED 3
  63.        MESSAGE 0 50 "                  "   ; same length as orig message
  64.      END
  65.  
  66. ;---------------------------------------------------------------
  67. ; repeatedly try to elicit a response from the remote system
  68. ; abort after ten minutes of no response
  69. ;
  70. F4    MULTI
  71.     DELAYED 600
  72.        ABORT_UNTIL       ; give up after ten minutes
  73.     UNTIL SUCCESS
  74.        {
  75.        TEXT "\r"
  76.        WAITFOR 2 "login:"
  77.        }
  78.     CANCEL_DELAYED LAST  ; no more need for the timed abort
  79.      END
  80.  
  81. ;---------------------------------------------------------------
  82. ; notify user of any incoming calls (only for DESQview and Hayes-comp modems)
  83. ;
  84. OnLoad     WHEN 0 "RING^M"
  85.      NOTIFY "Phone is ringing"
  86.  
  87. ;---------------------------------------------------------------
  88. ; add the standard bindings which have not been overridden
  89. #include "rbcomm"
  90.